﻿using System.Collections.Generic;
using Client.TopLevel;

namespace PersApp
{
    abstract class Roles
    {
        private static List<Role> roles;

        private Roles()
        { }

        public static List<Role> getRoles()
        {
            if (roles == null)
            {
                roles = new List<Role>();
                roles.Add(new Role(TLEmployee.ROLE_EMPLOYEE, "Работник"));
                roles.Add(new Role(TLEmployee.ROLE_MANAGER, "Менеджер"));
            }

            return roles;
        }

        public static Role getRoleByIndex(int index)
        {
            Role role = null;

            foreach(Role r in getRoles())
            {
                if(r.getId() == index)
                {
                    role = r;
                    break;
                }
            }

            return role;
        }
    }
}
